<html>
<head></head>
<body>
	filename: <input id="filename" cols="100"></input><br>
	<textarea id="inputBox" rows="15" cols="100"></textarea>
	<br><button onclick="convert();" >Convert</button><br>
	<textarea id="outputBox" rows="15" cols="100"></textarea>

<script type="text/javascript">
function convert() {
	var val = inputBox.value;
	val = val.replace(/\\/g,"\\\\"); // backslash must come first
	val = val.replace(/\r/g,"\\" + "r"); // carriage return
	val = val.replace(/\n/g,"\\" + "n"); // newline
	val = val.replace(/\t/g,"\\" + "t"); // tab
	val = val.replace(/\"/g,'\\"');  // quote
	val = val.replace(/\'/g,"\\'"); // apostrophe

	outputBox.value = "GestaltMedia.jsEncodeDownloadFinished(" + '"' + filename.value + '"' + ", " + '"' + val + '"' + ");";

}
</script>

</body>